// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "SimpleTypes.h"
#include "GameFramework/Actor.h"
#include "SimpleProjectile.generated.h"




UCLASS()
class SIMPLE_API ASimpleProjectile : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	ASimpleProjectile();

	UPROPERTY(EditDefaultsOnly, Category = Simple)
	FProjectileData ProjectileConfig;


	FORCEINLINE class UProjectileMovementComponent* GetProjectileMovementComponent() const { return ProjectileMovementComponent; }


protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	/*UFUNCTION()
	void HandleOnProjectileBounce(const FHitResult& ImpactResult, const FVector& ImpactVelocity);*/

	UFUNCTION()
	void HandleOnComponentHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

protected:
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Simple)
	class UStaticMeshComponent* ProjectileMeshComponent;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Simple)
	class UProjectileMovementComponent* ProjectileMovementComponent;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Simple)
	class USphereComponent* SphereComponent;

	UPROPERTY(EditDefaultsOnly, Category = Simple)
	class UParticleSystem* ExplosionParticle;



	UPROPERTY(EditDefaultsOnly, Category = Simple)
	class USoundCue* HitSound;


public:
	virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

};
